package com.yunhe.job.client;

import com.yunhe.job.client.fallback.TaskFallbackFactory;
import com.yunhe.common.model.ResultObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 定时任务Feign客户端
 * @author liuronglei
 */
@FeignClient(value = "yh-task", fallbackFactory = TaskFallbackFactory.class)
public interface TaskClient {

    /**
     * 任务执行
     * @param map 任务参数
     */
    @RequestMapping(value = "/{taskUrl}", method = RequestMethod.POST)
    ResponseEntity<ResultObject> runTask(@PathVariable("taskUrl") String taskUrl,
                                         @RequestParam Map<String, Object> map);

}
